<!-- extend from base layout -->
{% extends "layout.html" %}

{% block extra_css %}

{% endblock %}

{% block content %}
    <div class="container">
    <!-- header -->
    <nav class="sub-header row container-fluid">
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">消息中心</li>
            <li class="active">投诉记录</li>
        </ol>
        <div class="btn-group pull-right" role="group" aria-label="...">
        {% if request.query_string == 'status_reply=1' %}
            <a type="button" class="btn btn-default" href="{{ url_for('complaint.lists') }}">未处理</a>
            <a type="button" class="btn btn-default active">已处理</a>
        {% else %}
            <a type="button" class="btn btn-default active">未处理</a>
            <a type="button" class="btn btn-default" href="{{ url_for('complaint.lists', status_reply=1) }}">已处理</a>
        {% endif %}
        </div>
    </nav>

    <hr/>
    <!-- content -->
    <div class="table-responsive">
        {# <table class="table table-striped"> #}
        <table class="table table-hover">
            <thead>
            <tr>
                <th>投诉明细ID</th>
                <th>投诉用户</th>
                <th>被投诉用户</th>
                <th>投诉内容</th>
                <th>投诉时间</th>
                {% if request.query_string == 'status_reply=1' %}
                <th>回复内容</th>
                <th>回复时间</th>
                {% endif %}
            </tr>
            </thead>
            <tbody>
            {% for msg, user_profile_put, user_profile_get in pagination.items %}
            <tr class="text-muted">
                <td>{{ msg.id }}</td>
                <td>{{ user_profile_put.nickname | default('系统消息') }} [{{ user_profile_put.user_id }}]</td>
                <td>{{ user_profile_get.nickname }} [{{ user_profile_get.user_id }}]</td>
                <td>{{ msg.content }}</td>
                <td>{{ moment(msg.create_time).format('YYYY-MM-DD HH:mm:ss') }}</td>
                {% if request.query_string == 'status_reply=1' %}
                <td>{{ msg.content_reply }}</td>
                <td>{{ moment(msg.reply_time).format('YYYY-MM-DD HH:mm:ss') }}</td>
                {% endif %}
            </tr>
            {% endfor %}
            </tbody>
        </table>
        {# 翻页 #}
        {% from "macros.html" import render_pagination %}
        {{ render_pagination(pagination, 'complaint.lists') }}
    </div>
    </div>
{% endblock %}

{% block extra_js %}

{% endblock %}
